﻿namespace GSC.WebControls
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Data.OleDb;
    /// <summary>
    /// 后台编辑控件基类。
    /// </summary>
    /// <remarks>后台编辑控件基类。</remarks>
    public abstract class EditUserControlBase : UserControlBase, ISetIEditControl
    {
        #region ISetIEditControl
        /// <summary>
        /// 获取或设置编辑控件对象接口。
        /// </summary>
        IEditControl ISetIEditControl.EditControl
        {
            get
            {
                return this.EditControl;
            }
            set
            {
                this.EditControl = value;
            }
        }
        /// <summary>
        /// 编辑控件接口。
        /// </summary>
        /// <remarks>编辑控件接口。</remarks>
        protected IEditControl EditControl;
        #endregion
        /// <summary>
        /// 更新浏览器标题。
        /// </summary>
        /// <remarks>更新浏览器标题。</remarks>
        protected override void OnUpdateTitle()
        {
           
        }
        /// <summary>
        /// 更新区域信息。
        /// </summary>
        /// <remarks>更新区域信息。</remarks>
        protected override void OnUpdateCulture()
        {
            
        }
        /// <summary>
        /// 返回编辑列表。
        /// </summary>
        /// <remarks>返回编辑列表。</remarks>
        protected virtual void OnBack()
        {
            this.BackgroundControl.CenterHeadLeftCellUpdatePanel.ContentTemplateContainer.Controls.Clear();
            this.BackgroundControl.CenterHeadLeftCellUpdatePanel.Update();
            //更新浏览器标题。
            this.Page.Title = ((IGetLocalResourceObject)this.Page).GetLocalResourceObject("Title").ToString() + (" - [ " + ((IGetLocalResourceObject)this.EditControl.ListPlaceHolder.Controls[0]).GetLocalResourceObject("Title").ToString() + " ]");
            //卸载编辑控件。
            this.EditControl.UninstallEditControl();
            //更新列表子控件图片显示。
            ((IEditControlListDataBind)this.EditControl.ListPlaceHolder.Controls[0]).ListDataBind();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Back_Click(object sender, ImageClickEventArgs e)
        {
            this.OnBack();
            //
            AsyncListLoadingWaitControl.UpdateComplete();
        }
    }
}